#pragma once

#include <QtWidgets/QMainWindow>
#include "ui_txr_algo_dlm_demo.h"
#include <QSpinBox>
#include <QLineEdit>
#include <QCheckBox>
#include <QGridLayout>
#include "../txr_algo_dlm/txr_algo_dlm.h"
using namespace txr_algo_dlm;
class txr_algo_dlm_demo : public QMainWindow
{
	Q_OBJECT
public:
    txr_algo_dlm_demo(QWidget *parent = Q_NULLPTR);

	const static int DLM_CLASS_NUM = 15;

	struct st_test_info 
	{
		QString test_dir;
		QString model_path;
		bool save_ng;
		bool save_gd;
		bool save_txt;
		bool save_xml;
		bool class_en[DLM_CLASS_NUM] = { 0 };
		int class_th[DLM_CLASS_NUM] = { 0 };
		QString class_name[DLM_CLASS_NUM];
	};
	struct st_img_info
	{
		QString folder;
		QString file_path;
		QString file_name;
		int row;
		int col;
		int depth;
	};
	
	struct st_ui_obj_cfg
	{
		QGridLayout grid_layout;
		QCheckBox	checkbox_enable;
		QLabel		label_name;
		QLineEdit	lineedit_name;
		QSpinBox	spinbox_th;

	};

public slots:
	void OnOpenTest();
	void OnOpenModel();
	void OnTest();

	void DlmTest(st_test_info &info);
	bool LoadDlm(txr_algo_dlm_demo::st_test_info &info, TxrAlgoDlm &dlm);
private:
    Ui::txr_algo_dlm_demoClass ui;

	st_ui_obj_cfg * m_ui_obj_cfg[DLM_CLASS_NUM];

	QVector<unsigned short> m_v_gray_map[3];
};
